package ui;

import java.awt.Image;
import java.awt.Toolkit;
import javax.swing.ImageIcon;

import network.Buddy;
import network.Status;



public class BuddyEntry extends Buddy {
	


	private static final long serialVersionUID = 1L;
	protected static final Image IMG_BUDDY_ONLINE = Toolkit.getDefaultToolkit().getImage("src/images/buddy_online_small.png"); 
	protected static final Image IMG_BUDDY_OFFLINE = Toolkit.getDefaultToolkit().getImage("src/images/buddy_offline_small.png");  
	protected static final Image IMG_BUDDY_GREY = Toolkit.getDefaultToolkit().getImage("src/images/buddy_disabled_small.png");  
	
	private Chat chat;
	
	
	public BuddyEntry(String name, Status status) {
		super(name, status);
		this.chat = null;
	}

	public void setChat(Chat chat) {
		this.chat = chat;
	}
	
	public ImageIcon getImage() {
		return (this.getStatus() == Status.ONLINE) ? new ImageIcon(IMG_BUDDY_ONLINE) : new ImageIcon(IMG_BUDDY_OFFLINE);
	}
	
	public Chat getChat() {
		return this.chat;
	}
	
	public boolean isInChat() {
		return (this.chat != null);
	}
	
	public String toString() {
		return this.getName();
	}

}